package com.ddyx.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ddyx.entity.DealDetails;
import com.ddyx.mapper.DealDetailsMapper;
import com.ddyx.service.IDealDetailsService;

@Service("dealDetailsService")
public class DealDetailsServiceImpl implements IDealDetailsService {

	@Resource
	DealDetailsMapper dMapper;

	@Override
	public List<DealDetails> selectByDealId(int dealId, String billNo) {
		// TODO Auto-generated method stub
		return dMapper.selectByDealId(dealId,billNo);
	}

	@Transactional
	@Override
	public boolean insert(List<DealDetails> list) {
		// TODO Auto-generated method stub
		int i = list.size();
		int j = 0;
		for (DealDetails dealDetails : list) {
			int m = dMapper.insert(dealDetails);
			if(m == 1)
				j++;
		}
		if(i == j)
			return true;
		return false;
	}

}
